<template>
  <TagList :data="stockState.statistics" :selectable="false" @change="tagChange" />
  <StockList v-bind="$attrs" />
</template>

<script lang="ts">
  import StockList from './stock-list.vue'
  import { inject } from 'vue'
  import TagList from '../../components/cz-tag-list.vue'

  export default {
    name: 'CarModelStockBody',
    components: {
      StockList,
      TagList,
    },
    emits: ['loadData'],
    setup(_props, { emit }) {
      const stockState = inject('carModelStockState')

      const tagChange = (val: string) => {
        stockState.queryParam.type = val
        emit('loadData')
      }

      return {
        stockState,
        tagChange,
      }
    },
  }
</script>
